package view;

import java.awt.Image;
import javax.swing.*;

/**
 * 
 * @author Sonny Sandberg
 */
public class PicturePanel 
{
    private JPanel backgroundPanel;
    
    public PicturePanel(int width, int height, String path)
    {
        backgroundPanel = new JPanel(null);
        
        ImageIcon icon = new ImageIcon(getClass().getResource(path));
        JLabel bgLabel = new JLabel(icon);

        Image image = icon.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH); // Scale picture
        icon.setImage(image); // Put image into the logoIcon

        bgLabel.setBounds(0, 0, width, height);

        backgroundPanel.add(bgLabel);
        backgroundPanel.setBounds(0, 0, width, height);
        backgroundPanel.setVisible(true);
    }

    /**
     * 
     * @return JPanel
     */
    public JPanel getBackgroundPanel()
    {
        return backgroundPanel;
    }
}